package com.qianfeng.smartdevice.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by wenka on 2022/3/14 17:24
 *
 * @author Jackiechan
 * @version 1.0
 * @since 1.0
 */
public class MyStringUtils {
    public static final String mobileRegex = "^((13[0-9])|(14[5,7,9])|(15([0-3]|[5-9]))|(16[5,6])|(17[0-8])|(18[0-9])|(19[1、5、8、9]))\\d{8}$";
    public static final String emaiRegex = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";

    /**
     *
     * @param content
     * @param regex
     * @return
     */
    public static boolean check(String content,String regex){
        Pattern p=Pattern.compile(regex,Pattern.CASE_INSENSITIVE);
        Matcher m=p.matcher(content);
        return m.matches();
    }
}
